basicly for the MPG move I'm useing code similar to the code in the Init3AnalogPlusMPG.c file. made some changes as I have 4 speed selections. But I was wondering, at higher factors and higher MPG rotation speeds things get a little jerkey. Wondering if anyone have a suggestion on adding code to smooth it out a bit at higher speeds?
And like I said in the earler post. I would like to add code also, so I could have an jog bit selected and if another button (bit) is pressed while that is active it would zero that axis. Anyone have an idea how to do that?
I know within MACH you can set it up with the OEM Triggers and OEM codes to do something like that. How ever that looks more to react to 1 bit of intput rather then 2, and I was looking to avoid having to have 4 separate I/O buttons for each axis I have to zero (X,Y, Z1 and Z2)..
Thanks for any help.
sorry for not being more spacific in earler message
for(;;)
{
WaitNextTimeSlice();
// convert quadrature to 2 bit binary
BitA = ReadBit(QA);
PosNoWrap = (ReadBit(QB) ^ BitA) | (BitA<<1);
// Diff between expected position based on average of two prev deltas
// and position with no wraps. (Keep as X2 to avoid division by 2)
DiffX2 = 2*(Pos-PosNoWrap) + (Change2+Change1);
// Calc quadrature wraparounds to bring Diff nearest zero
// offset by 128 wraps to avoid requiring floor()
wraps = ((DiffX2+1028)>>3)-128;
// factor in the quadrature wraparounds
NewPos = PosNoWrap + (wraps<<2);
Change2 = Change1;
Change1 = NewPos - Pos;
Pos = NewPos;
if (ReadBit(31)) // is X1 selected?
Factor = 1.0;
else if (ReadBit(32)) // is X100 selected?
Factor = 75.0;
else // must be X10 then
Factor = 10.0;
if (ReadBit(28)) // is x selected?
ch0->Dest += Change1 * Factor;
else if (ReadBit(29)) // is y selected?
ch1->Dest += Change1 * Factor;
else if (ReadBit(30)) // is z selected?
ch2->Dest += Change1 * Factor;
}
--- In DynoMotion@yahoogroups.com, "wcarrothers" <wcarrothers@...> wrote:
>
> Hello.
>
> Just got my pendant working and I set it up with an axis selector switch so each axis could jog on one optical in Oder. I have things moving but also wanted to have a button on the control that when pressed it would trigger another digital input. So that input bit + which ever input bit is selected for jogging would zero that axis in Mach. Figure there has to be some code out there for doing that.
>
> Also. Want to get smoother movement when spinning the encoder for fast jogging. Didn't know if there was a trick to that.
>
> I know I should post the code I'm using but pretty much starting with the standard Mach with 2 mpg c code..
>
> B.
>
> B.
>